package com.cloudptt.api.product.func.lbs.server;

import android.content.Context;

import com.cloudptt.api.models.lbs.LocationData;
import com.cloudptt.api.models.lbs.VitalData;
import com.cloudptt.api.product.config.lbs.LocationConfig;

public abstract class AbstractLocServer{

	protected AbstractLocServer()
	{
		
	}
	
	public abstract void startLBS(Context ctx,LocationConfig localConfig);
	public abstract void updateConfig(Context ctx,LocationConfig localConfig);
	public abstract void stopLBS();
	public abstract LocationData getCurLocation();
//	public abstract VitalData getCurVitalData();
	
	protected boolean isInvalidReportLocationData(LocationConfig localConfig,long lastestRptTime,double distance)
	{
		Long peroid = System.currentTimeMillis()-lastestRptTime;
		
		int timeInterval = 10;
		int distanceInterval = 10;
		if(localConfig != null)
		{
			timeInterval = localConfig.getTimeInterval();
			distanceInterval = localConfig.getDistanceInterval();
		}
		
		if(peroid < (timeInterval*1000) || distance < distanceInterval)
		{
			return true;
		}
		return false;
	}
}
